package day7;

import org.junit.Test;

public class Demo {
	public static void main(String[] args) {
		Student student = new Student();
		student.id = 23;
		student.name = "张三";
		student.show();
		
		// 访问静态属性、静态方法有两种方式
		// The static field Student.country should be accessed in a static way
		// 对象.静态属性   对象.静态方法：让别人容易产生歧义，以为这个属性和方法是实例属性，实例方法
		student.country = "中国";
		System.out.println(student.country);
		// static way: 类名.属性
		Student.country = "中";
		System.out.println(Student.country);
		
		int max1 = student.getMax(3, 2);
		System.out.println(max1);
		int max2 = Student.getMax(3, 2);
		System.out.println(max2);
	}
	
	@Test
	public void test2() {
		Student student1 = new Student();
		student1.id = 1;
		student1.name = "zhangsan";
		
		Student student2 = new Student();
		student2.id = 1;
		student2.name = "zhangsan";
		
		student1.country = "中国";
		
		System.out.println(student1.country);// 中国
		System.out.println(student2.country);// 中国
		System.out.println(Student.country);// 中国
		Student.print();
	}
	
	
	@Test
	public void test3() {
		// 静态的属性和静态的方法是属于这个类的，相当于公共的，可以被new出来的对象访问
		int max = Student.getMax(3, 5);
		System.out.println(max);
	}
	
	@Test
	public void test4() {
		int[] array = {1, 64, 89, 23};
		int max = ArrayUtil.max(array);
		System.out.println(max);
	}
	
	@Test
	public void test5() {
		Teacher teacher1 = new Teacher();
		Teacher teacher2 = new Teacher();
//		Float i = 0.1f;
//		Integer a = new Integer(2);
//		System.out.println(i);
//		System.out.println(a);
		String str = "1234f"; 
		System.out.println(Integer.parseInt(str));
	}
}
